<?php
	/**
	 * @ignore
	 */
	if( defined("apl_".__FILE__)) return;
	define("apl_".__FILE__,"apl_".__FILE__);
	
	
	/**
	 * HTML Table Object
	 *
	 * @package apl
	 * @subpackage html
	 */
	class AplHtmlTable
	{
		public $Width;
		public $Align;
		public $CustomLine;
		public $Class;
		public $Style;
		public $Spacing;
		public $Padding;
        public $Border;
        public $Height;
		
		public $Rows;
        
        
		function __construct(){
			$this->Rows = Array();
		}
	
		function  __destruct(){
		}
		/**
		*	Builds <table ...> tag
		* 	@return String
		*/
		public function openTableTag(){
			$tag = "<table ";
            if( isset($this->Border))
                $tag = $tag." border='".$this->Border."' ";
            if( isset($this->Width))
                $tag = $tag." width='".$this->Width."' ";
            if( isset($this->Height))
                $tag = $tag." height='".$this->Height."' ";
			if( isset($this->Align))
				$tag = $tag." align='".$this->Align."' ";
			if( isset($this->Class) )
				$tag = $tag."class='".$this->Class."' ";
			if( isset($this->Style) )
				$tag = $tag."style='".$this->Style."' ";
			if( isset( $this->Padding))
				$tag=$tag." cellpadding=".$this->Padding." ";
			if( isset( $this->Spacing))
				$tag=$tag." cellspacing=".$this->Spacing." ";
			if( isset($this->CustomLine) )
				$tag = $tag." ".$this->CustomLine." ";
			
			$tag = $tag . ">";
			return $tag;
		}
		public function closeTableTag(){
			return "</table>";
		}
       
        
		public function buildTag(){
            $tag = $this->openTableTag();              
            foreach( $this->Rows as $key=>$val ){
                $tag .= $val->buildTag();
            }            
            $tag .= $this->closeTableTag();
            return $tag;
		}
        
        public function removeRow( $rowId ){
            if( isset($this->Rows[ $rowId ]) )
                unset( $this->Rows[ $rowId ] );    
        }
                
        public function addRow( $rowId, AplHtmlTableRow $row ){
            $this->Rows[ $rowId ] = $row;
        }
       
        
        
		
	}
?>